function parseValue(value: string | number) : number {
  if (typeof value === 'string') {
    const numValue = Number(value)
    if (isNaN(numValue) || isFinite(numValue)) {
      return 0
    }
    return numValue
  }

  return value
}

parseValue('1')
parseValue('abc')
parseValue(2)

const el = document.getElementById('app') as HTMLDivElement

type Point = {
  x: number
  y: number
}

const point: Point = { x: 1, y: 2 }